package com.jqsoft.launcher.util;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.jqsoft.android.facesdk.FaceSDKManager;
import com.jqsoft.launcher.activity.childCareManagement.XSEFollowUpRecordActivity;
import com.jqsoft.launcher.activity.diabetesMellitus.DiabetesMellitusFollowUpActivity;
import com.jqsoft.launcher.activity.highblood.HBPFollowUpRecordActivity;
import com.jqsoft.launcher.activity.majorPsychosis.MajorPsychosisFollowUpActivity;
import com.jqsoft.launcher.activity.pregnantWomen.PregnantWomenFollowUpActivity;

import java.io.Serializable;

/**
 * 用于组件间跳转工具
 * Created by zzwang on 2017/12/14.
 */

public class GotoActivityHelper {

    /**
     * 跳转到人脸识别页面
     *
     * @param context
     * @param name        用户名称
     * @param id          身份证号
     * @param imagebase64 头像base64串
     * @param obj         偷穿对象
     */
    public static void gotoFaceDetecetionActivity(Context context, String name, String id, String imagebase64,String photo, Object obj,String pagetype) {
        try {
//            String[]  strs=imagebase64.split(",");
//            String[]  strs2=imagebase64.split(",");
//            FaceSDKManager.toFaceDetect(context, name, id, strs[1],strs2[1], obj,pagetype);
            FaceSDKManager.toFaceDetect(context, name, id, imagebase64,imagebase64, obj,pagetype);
        } catch (Exception e) {
            String log = e.getLocalizedMessage();
            e.printStackTrace();

        }
    }


    /**
     * 人脸识别成功后，页面跳转
     *
     * @param context
     * @param obj     原入口透传对象
     */
    public static void gotoMediaDetailActivity(Context context, Serializable obj,String pagetype) {
        if(pagetype.equals("1")){
            Intent intent = new Intent(context, HBPFollowUpRecordActivity.class);
            Bundle bundle = new Bundle();
            bundle.putSerializable("HBPGuanLi_PersonInfo", obj);
            intent.putExtras(bundle);
            context.startActivity(intent);
        }else if(pagetype.equals("2")){
            Intent intent = new Intent(context, DiabetesMellitusFollowUpActivity.class);
            Bundle bundle = new Bundle();
            bundle.putSerializable("DMGuanLi_PersonInfo", obj);
            intent.putExtras(bundle);
            context.startActivity(intent);
        }else if(pagetype.equals("3")){
            Intent intent = new Intent(context, MajorPsychosisFollowUpActivity.class);
            Bundle bundle = new Bundle();
            bundle.putSerializable("MPGuanLi_PersonInfo", obj);
            intent.putExtras(bundle);
            context.startActivity(intent);
        }else if(pagetype.equals("4")){
            Intent intent = new Intent(context, XSEFollowUpRecordActivity.class);
            Bundle bundle = new Bundle();
            bundle.putSerializable("MPGuanLi_PersonInfo", obj);
            intent.putExtras(bundle);
            context.startActivity(intent);
        }else if(pagetype.equals("5")){
            Intent intent = new Intent(context, PregnantWomenFollowUpActivity.class);
            Bundle bundle = new Bundle();
            bundle.putSerializable("MPGuanLi_PersonInfo", obj);
            intent.putExtras(bundle);
            context.startActivity(intent);
        }

    }

}
